//这个为子组件
import {useState, useImperativeHandle,forwardRef} from 'react'
function Child(props,ref){
    useImperativeHandle(ref,() => ({
        //childHandle即为子组件暴露给父组件的方法
        childHandle : () => {
    
        },
        testid:110,
    }))
    // console.log('props', props);
    return (
        <div>子组件</div>
    )
}
export default forwardRef(Child)


// import { useState, useImperativeHandle, forwardRef } from 'react';

// const Child = forwardRef((props, ref) => {
//   useImperativeHandle(ref, () => ({
//     // childHandle 即为子组件暴露给父组件的方法
//     childHandle: () => {
//       console.log('childHandle, childHandle');
//     },
//     testid: 110,
//   }));

//   return <div>子组件</div>;
// });

// export default Child;
